//
// Created by Jisam on 2024/7/13.
//
#include "iostream"
using  namespace std;
int main(){
    int n;
    while (cin >> n){
        if(!n) break;
        int s = 0;
        int a;
        for(int i = 0 ;i < n; i ++){
            cin >> a;
            s += a;
        }
        cout << s <<"\n";
    }
    return  0;
}